package com.education.service.impl;

import com.education.dao.DissentScoreDao;
import com.education.model.Dissent;
import com.education.service.DissentScoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2017/8/16.
 */
@Service
public class DissentScoreServiceImpl implements DissentScoreService{

    @Autowired
    private DissentScoreDao dissentScoreDao;

    /**
     * 2017/8/16  王娇
     * 查询学生对该课程的成绩异议
     * 一个课程现有有效的异议只有一个
     * @param teacherId
     * @return
     */
    public List<Dissent> getDissent(Integer teacherId) throws Exception {
        int courseId=dissentScoreDao.getCourseId(teacherId);
        List<Dissent> list=dissentScoreDao.getDissent(courseId);
        return list;
    }

    /**
     * 查询学生成绩异议（唯一）
     * @param dissent
     * @return
     */
    public Dissent getDissentInfo(Dissent dissent) throws Exception {
       Dissent si=dissentScoreDao.getDissentInfo(dissent);
        return si;
    }

    /**
     * 删除
     * @param dissentId
     * @return
     */
    public int deleteDissent(Integer dissentId) throws Exception {
      int result= dissentScoreDao.deleteDissentInfo(dissentId);
        return result;
    }
}
